//package com.dengyuanke.upms.logic.config.feign;
//
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestAttributes;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * 发送FeignClient设置Header信息.
// * http://www.itmuch.com/spring-cloud-sum/hystrix-threadlocal/
// * Hystrix传播ThreadLocal对象
// */
//@Component
//public class TokenFeignClientInterceptor implements RequestInterceptor {
//
//    /**
//     * token放在请求头.
//     *
//     * @param requestTemplate 请求参数
//     */
//    @Override
//    public void apply(RequestTemplate requestTemplate) {
//        ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
//        HttpServletRequest request = attributes.getRequest();
//        //添加token
//        requestTemplate.header("access_token", request.getHeader("Authorization"));
//    }
//}
